<template>
  <div id="foodlist">
    <swiper :datalist="datalist"></swiper>
  </div>
</template>

<script>
import http from "../../network/request.js";
import swiper from "../../components/swiper.vue";
export default {
  data() {
    return {
      datalist: [],
    };
  },
  components: {
    swiper,
  },
  mounted() {
    http({
      url: "/v2/index_entry",
    }).then((res) => {
      //console.log(res.data);
      let data = [];
      for (var i = 0, j = 0; i <= res.data.length; i += 8, j++) {
        data[j] = res.data.splice(0, 8);
        //console.log(res.data.length);
      }

      this.datalist = data;
      //  console.log(this.datalist);
    });
  },
};
</script>

<style>
</style>